var whiteCat = {
    ajax: function (options) {
        // options.type;
        // options.url;
        // options.isAsync
        // options.data;
        // options.succes;
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (this.status == 200 && this.readyState == 4) {
                options.succes(this.responseText);
            }
        }
        var str = "";
        if (options.data) {
            for (var key in options.data) {
                str += `${key}=${options.data[key]}&`;
            }
            str = "?" + str.slice(0, -1);
        }
        options.url = options.url + str;
        xhr.open(options.type, options.url, options.isAsync ? options.isAsync : true);
        xhr.send();
    },
    jsonp: function (options) {
        // options.type;
        // options.url;
        // options.isAsync
        // options.data;
        // options.success;
        // options.jsonp;
        console.log(options);
        var myName = "cat" + new Date().getTime();
        window[myName] = options.success;
        console.log("myName==>" + myName);
        console.log("window[myName]==>" + window[myName]);
        var script = document.createElement("script");
        var str = "";
        if (options.data) {
            for (var key in options.data) {
                str += `${key}=${options.data[key]}&`;
            }
            str = "?" + str;
        }
        options.url = options.url + str + options.jsonp + "=" + myName;
        console.log(options.url);
        script.src = options.url;
        document.body.appendChild(script);
        setTimeout(function () {
            script.remove();
        }, 10);
    }
}